import { defineStore } from 'pinia'

export const appCurrentState = defineStore('currentState', {
  state: () => {
    return {
      // 当前详情id
      currentDetailId: '',
      // 当前状态是否是编辑
      isEdit: true,
      // 当前选择的对象数据
      currentDetailInfo: '',
      // 页面类型
      type:'',
      // 单点登陆携带id
      ssoLoginObj:''
    }
  },

  actions: {
    SET_CURRENT_ID(id) {
      this.currentDetailId = id
    },
    SET_CURRENT_STATE(editState) {
      this.isEdit = editState
    },
    SET_CURRENT_ITEM(item) {
      this.currentDetailInfo = item
    },
    SET_CURRENT_TYPE(item) {
      this.type = item
    },
    SET_SSOLOGIN_INFOS(item){
      this.ssoLoginObj = item
    }
  },

  getters: {
    getCurrentDetailId: state => state.currentDetailId,
    getCurrentDetailInfo: state => state.currentDetailInfo,
    getCurrentStatus: state => state.isEdit,
    getCurrentType: state => state.type,
    getSsoLoginInfos: state => state.ssoLoginObj
  }
})
